**********
**********
**********
*This is the do-file to replicate the analyses and create the figures that appear in the Singh and Tir article, "Partisanship, Militarized International Conflict, and Electoral Support for the Incumbent," which appears in Political Research Quarterly
**********
**********
**********


*Model 1
melogit voted_inc 		i.initiator_past1 		i.target_past1							 partyID_inc unemployment GDP_growth polity  if voted == 1 || cntryyearnum: partyID_inc,  intpoints(2) iterate(55) intmethod(ghermite) difficult


*Model 2 and Figure 1
melogit voted_inc 		i.initiator_past1##i.partyID_inc 		i.target_past1##i.partyID_inc			 unemployment GDP_growth polity  if  voted == 1 || cntryyearnum: partyID_inc,  intpoints(2) iterate(55) intmethod(ghermite)
margins ,  dydx(initiator_past1 target_past1) over(partyID_inc) atmeans at(initiator_past1=0 target_past1=0) predict(mu fixedonly) post coeflegend
marginsplot, /// 
     recast(scatter) recastci(rcap) scheme(s1color) horizontal aspect(.10, placement(south))  ///
	 ci1opts(color(bluishgray*1.5) lwidth(medthick))  /// 
     plot1opts(mcolor(blue)) scale(.5) /// 
	 title("") xline(0, lpattern(dash) lcolor(black)) ///  
	 ylabel(, nogrid labsize(small))  ///
     ytitle("")  xtitle("                                       {&Delta}Pr(Vote for Incumbent) if MID Onset", size(small)) ///
	 bydimension(_deriv, ) byopt(title("") rows(2) noxrescale) 	subtitle( , size(small) fcolor(bluishgray)) 
	 
	 
*Model 3 and Figure 2
melogit voted_inc 		i.initiator_past1##i.hostility_dich##i.partyID_inc 		i.target_past1##i.hostility_dich##i.partyID_inc			 unemployment GDP_growth polity  if  voted == 1 || cntryyearnum: partyID_inc,  intpoints(2) iterate(55) intmethod(ghermite)
margins ,  dydx(initiator_past1 target_past1) over(partyID_inc) atmeans at(initiator_past1=0 target_past1=0 hostility_dich=(0 1)) predict(mu fixedonly) post
marginsplot, /// 
     recast(scatter) recastci(rcap) scheme(s1color) horizontal aspect(.17, placement(south))  ///
	 ci1opts(color(bluishgray*1.5) lwidth(medthick))  /// 
     plot1opts(mcolor(blue)) scale(.5) /// 
	 title("") xline(0, lpattern(dash) lcolor(black)) ///  
	 ylabel(, nogrid labsize(small))  ///
     ytitle("")  xtitle("                                       {&Delta}Pr(Vote for Incumbent) if MID Onset", size(small)) ///
	 bydimension(_deriv hostility_dich, elabel(1 "Initiator, Low Hostility Level" 2 "Initiator, High Hostility Level" 3 "Target, Low Hostility Level" 4 "Target, High Hostility Level")) ///
	 byopt(title("") rows(2) noxrescale) 	subtitle( , size(small) fcolor(bluishgray)) 

	 
*Figure 2A
melogit voted_inc 		i.initiator_past1_halfyear##i.hostility_dich##i.partyID_inc 		i.target_past1_halfyear##i.hostility_dich##i.partyID_inc			 unemployment GDP_growth polity  if  voted == 1 || cntryyearnum: partyID_inc,  intpoints(2) iterate(55) intmethod(ghermite)
margins ,  dydx(initiator_past1_halfyear target_past1_halfyear) over(partyID_inc) atmeans at(initiator_past1_halfyear=0 target_past1_halfyear=0 hostility_dich=(0 1)) predict(mu fixedonly) post
marginsplot, /// 
     recast(scatter) recastci(rcap) scheme(s1color) horizontal aspect(.17, placement(south))  ///
	 ci1opts(color(bluishgray*1.5) lwidth(medthick))  /// 
     plot1opts(mcolor(blue)) scale(.5) /// 
	 title("") xline(0, lpattern(dash) lcolor(black)) ///  
	 ylabel(, nogrid labsize(small))  ///
     ytitle("")  xtitle("                                       {&Delta}Pr(Vote for Incumbent) if MID Onset", size(small)) ///
	 bydimension(_deriv hostility_dich, elabel(1 "Initiator, Low Hostility Level" 2 "Initiator, High Hostility Level" 3 "Target, Low Hostility Level" 4 "Target, High Hostility Level")) ///
	 byopt(title("") rows(2) noxrescale) 	subtitle( , size(small) fcolor(bluishgray)) 
	 
	 
*Figure 2B
melogit voted_inc 		i.initiator_past1##i.hostility_dich##i.partyID_inc 		i.target_past1##i.hostility_dich##i.partyID_inc		i.initiator_past1##i.hostility_dich##i.ID_not_inc 		i.target_past1##i.hostility_dich##i.ID_not_inc		 unemployment GDP_growth polity  if  voted == 1 || cntryyearnum: partyID_inc,  intpoints(2) iterate(55) intmethod(ghermite)
margins ,  dydx(initiator_past1 target_past1) over(partyID_inc) atmeans at(initiator_past1=0 target_past1=0 ID_not_inc=0 hostility_dich=(0 1)) predict(mu fixedonly) post
marginsplot, /// 
     recast(scatter) recastci(rcap) scheme(s1color) horizontal aspect(.17, placement(south))  ///
	 ci1opts(color(bluishgray*1.5) lwidth(medthick))  /// 
     plot1opts(mcolor(blue)) scale(.5) /// 
	 title("") xline(0, lpattern(dash) lcolor(black)) ///  
	 ylabel(, nogrid labsize(small))  ///
     ytitle("")  xtitle("                                       {&Delta}Pr(Vote for Incumbent) if MID Onset", size(small)) ///
	 bydimension(_deriv hostility_dich, elabel(1 "Initiator, Low Hostility Level" 2 "Initiator, High Hostility Level" 3 "Target, Low Hostility Level" 4 "Target, High Hostility Level")) ///
	 byopt(title("") rows(2) noxrescale) 	subtitle( , size(small) fcolor(bluishgray)) 
